package app.models;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;

@Entity
@Table(name = "CARTEIRA_CONVENIO")
public class CarteiraConvenio implements Pojo {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3486906602015611506L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID")
	private Long id;
	
	@Column(name = "ID_CONVENIO")
	private Integer idConvenio;
	
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_CONVENIO", referencedColumnName = "ID", insertable = false, updatable = false)
	private Convenio convenio;
	
	@Column(name = "NUMERO", columnDefinition = "varchar(50)")
	private String numero;
	
	@Column(name = "VIA", columnDefinition = "integer")
	private Integer via;
	
	@Column(name = "ABRANGENCIA", columnDefinition = "varchar(50)")
	private String abrangencia;
	
	@Pattern(regexp = "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}")
	@Column(name = "DATA_VENCIMENTO", columnDefinition = "date")
	private String dataVencimento;

	@Override
	public Long getId() {
		return id;
	}

	@Override
	public void setId(Long id) {
		this.id = id;
	}

	public Integer getIdConvenio() {
		return idConvenio;
	}

	public void setIdConvenio(Integer idConvenio) {
		this.idConvenio = idConvenio;
	}

	public Convenio getConvenio() {
		return convenio;
	}

	public void setConvenio(Convenio convenio) {
		this.convenio = convenio;
	}

	public String getNumero() {
		return numero;
	}

	public void setNumero(String numero) {
		this.numero = numero;
	}

	public Integer getVia() {
		return via;
	}

	public void setVia(Integer via) {
		this.via = via;
	}

	public String getAbrangencia() {
		return abrangencia;
	}

	public void setAbrangencia(String abrangencia) {
		this.abrangencia = abrangencia;
	}

	public String getDataVencimento() {
		return dataVencimento;
	}

	public void setDataVencimento(String dataVencimento) {
		this.dataVencimento = dataVencimento;
	}
	
}
